//
//  FLUtilsMacro.h
//  BaseRepo
//
//  Created by leo on 2018/8/9.
//  Copyright © 2018年 LEO. All rights reserved.
//

#ifndef FLUtilsMacro_h
#define FLUtilsMacro_h

#define  FL_ScreenWidth   [UIScreen mainScreen].bounds.size.width
#define  FL_ScreenHeight  [UIScreen mainScreen].bounds.size.Height




#pragma mark - 常用

///自定义输出信息呢
#ifdef DEBUG
#define FLLog(FORMAT, ...) fprintf(stderr, "%s:%d\t%s\n", [[[NSString stringWithUTF8String: __FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat: FORMAT, ## __VA_ARGS__] UTF8String]);
#else
#define FLLog(FORMAT, ...) nil
#endif

///弱引用和强引用
#define FL_WEAK_SELF(type)  __weak typeof(type) weak##type = type;
#define FL_STRONG_SELE(type) __strong typeof(type) strong##type = weak##type;

///jpg图片
#define FL_LoadJPG(name) [UIImage imageNamed:[NSString stringWithFormat:@"%@.jpg",name]]

///png图片
#define FL_LoadPNG(name) [UIImage imageNamed:[NSString stringWithFormat:@"%@",name]]

///圆角
#define FL_CORNER_RADIUS_5 5.f
#define FL_CORNER_RADIUS_3 3.f



#pragma mark - 设备信息

///沙盒目录
#define FL_DOCUMENT_PATH [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]

///沙盒缓存
#define FL_CACHES_PATH [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]

///获取Version
#define FL_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

//获取应用名字
#define FL_NAME [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]


///Build
#define FL_BUILD [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]

///唯一标识符
#define FL_IDENTIFIER [[[UIDevice currentDevice] identifierForVendor] UUIDString]

///是否iPhone判断
#define FL_IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

///是否iPad
#define FL_IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

///是否高清屏
#define FL_IS_RETAINA ([[UIScreen mainScreen] scale] >= 2.0)


///是否320宽度
#define FL_IPHONE_320 (FL_IS_IPHONE && FL_SCREEN_MIN_LENGTH < 375.f)

///是否iPhone4S以下
#define FL_IPHONE_4S_OR_LESS (FL_IS_IPHONE && FL_SCREEN_MAX_LENGTH < 568.f)
///是否iPhone5，5c,5s
#define FL_IPHONE_5S (FL_IS_IPHONE && FL_SCREEN_MAX_LENGTH == 568.f)
///是否iPhone6，7，8
#define FL_IPHONE_6 (FL_IS_IPHONE && FL_SCREEN_MAX_LENGTH == 667.f)
///是否iPhone6p,7p,8p
#define FL_IPHONE_6P (FL_IS_IPHONE && FL_SCREEN_MAX_LENGTH == 736.f)
///是否iPhoneX
#define FL_IPHONE_X (FL_IS_IPHONE && ((FL_WIDTH >= 375.f)&&(FL_HEIGHT >= 812.f)))

///等于v返回真
#define LYCSYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
///小于v返回真
#define FL_SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
///小于或等于v返回真
#define FL_SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
///大于v返回真
#define FL_SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
///大于或等于v返回真
#define FL_SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

#pragma mark - 位置大小

///获取屏幕宽度与高度
#define FL_SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define FL_SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width

//适应横屏竖屏
#define FL_SCREEN_MAX_LENGTH     MAX(FL_SCREEN_WIDTH, FL_SCREEN_HEIGHT)
#define FL_SCREEN_MIN_LENGTH     MIN(FL_SCREEN_WIDTH, FL_SCREEN_HEIGHT)

///状态栏高度
#define FL_STATUS_BAR_HEIGHT [[UIApplication sharedApplication] statusBarFrame].size.height

///导航条高度
#define FL_NVAIGATION_HEIGHT 44.f

///标签栏高度
#define FL_TAB_BAR_HEIGHT (FL_STATUS_BAR_HEIGHT > 20 ? 83.f : 49.f)

///安全高度
#define FL_SAFE (FL_IPHONE_X?34.f : 0.f)

///顶部总高度
#define FL_TOP_HEIGHT (FL_STATUS_BAR_HEIGHT + FL_NVAIGATION_HEIGHT)

//高度
#define DISTANCE_10 10
#define DISTANCE_15 15
#define DISTANCE_20 20
#define DISTANCE_30 30
#define DISTANCE_40 40
#define DISTANCE_44 44
#define DISTANCE_50 50

//缩放（以6为标准）
#define FL_SCALE (FL_ScreenWidth == 375?1.0:(FL_ScreenWidth == 320)?(320/375.0):(414/375.0))
#define FL_RGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0]
#define FL_HEX(hex) [UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16)) / 255.0 green:((float)((hex & 0xFF00) >> 8)) / 255.0 blue:((float)(hex & 0xFF)) / 255.0 alpha:1]



#endif /* FLUtilsMacro_h */
